import search.*;
import java.util.*;
/**
 * A travelling salesman for the city graph.
 * 
 * @author Thomas Kingston 
 * 
 */
public class TravellingSalesmanStateSpace extends Digraph<TourState,TourEdge>
{
    // The state space that this salesman operates over
    private TourFinder tourFinder;
    // The tour state this salesman starts at
    private TourState start;
    // The tour state this salesman aims to find a route to
    private TourState goal;
  
    /**
     * Create a new travelling salesman.
     * @param tourFinder The state space that this salesman operates over.
     * @param start The name of the city this salesman starts at. The city node will be found automatically.
     * @param goal The name of the city this salesman aims to find a route to. The city node will be found automatically.
     */
    public TravellingSalesmanStateSpace(TourFinder tourFinder, String start, String goal)
    {
        this.tourFinder = tourFinder;
        //this.
        this.start = tourFinder.findTourState(start);
        this.goal = tourFinder.findTourState(goal);
    }

    /**
     * @return The city node this salesman starts at.
     */ 
    public TourState getStart()
    {
        return start;
    }
    
    /**
     * Checks if a specified state is the goal of this salesman.
     * @param pointer The pointer to check against the goal.
     * @return true if the goal pointer and the parameter are equal, false otherwise.
     */
    public boolean isGoal(TourState pointer)
    {
        return (pointer.equals(goal));
    }
       @Override  
    /**
     * Get the edges corresponding to a given node.
     * @param node The node in question.
     * @return A collection of edges that relate to this node.
     */
    public List<TourEdge> getEdges(TourState node)
    {
    	   //node.getData()
    	//if (!associatedEdges.containsKey(node))
        //{
        //    associatedEdges.put(node, new ArrayList<TourEdge>());
        //}
        //return associatedEdges.get(node);
    	   return null;
    }   
    
    @Override
   /**
     *  Associate a given edge with a given node. 
     *  @param edge The edge to associate.
     *  @param node The node to associate it with.
     */
    public void associateEdgeWithNode(TourEdge edge, TourState node)
    {
        /*if (!associatedEdges.containsKey(node))
        {
            associatedEdges.put(node, new ArrayList<TourEdge>());
        }
        ArrayList<TourEdge> edges = associatedEdges.get(node);
        if (!edges.contains(edge))
        {
            edges.add(edge);
        }*/
    }
}
